#define _CRT_SECURE_NO_WARNINGS 1
#include "SList.h"

void SLTNodeTest1()
{
	SLTNode* plist = NULL;
	SLTNodePushBack(&plist, 1);
	SLTNodePushBack(&plist, 2);
	SLTNodePushBack(&plist, 3);
	SLTNodePushBack(&plist, 4);

	SLTNodePrint(plist);

	SLTNodePopFront(&plist);
	SLTNodePrint(plist);
}

void SLTNodeTest2()
{
	SLTNode* plist = NULL;
	SLTNodePushFront(&plist, 1);
	SLTNodePushFront(&plist, 2);
	SLTNodePushFront(&plist, 3);
	SLTNodePushFront(&plist, 4);
	SLTNodePushFront(&plist, 5);
	SLTNodePrint(plist);

	SLTNodePopBack(&plist);
	SLTNodePrint(plist);
}

void SLTNodeTest3()
{
	SLTNode* plist = NULL;
	SLTNodePushFront(&plist, 1);
	SLTNodePushFront(&plist, 2);
	SLTNodePushFront(&plist, 3);
	SLTNodePushFront(&plist, 4);
	SLTNodePushFront(&plist, 5);
	SLTNodePrint(plist);

	SLTNode* ret = SLTNodeFind(plist, 4);
	SLTNodeInsertBefore(&plist, ret, 10);
	SLTNodePrint(plist);

	SLTNodeInsertAfter(&plist, ret, 100);
	SLTNodePrint(plist);

	SLTNodeEraseBefore(&plist, ret);
	SLTNodePrint(plist);

	SLTNodeEraseAfter(ret);
	SLTNodePrint(plist);

	SLTNodeErase(&plist, ret);
	SLTNodePrint(plist);

	SLTNodeDestory(&plist);
}

int main()
{
	SLTNodeTest3();

	return 0;
}